#!/usr/bin/env bash

ip=`ifconfig eth0|grep inet|grep -v 127.0.0.1|grep -v inet6|awk '{print $2}'|tr -d "addr:"`
hn=`cat /etc/hostname`
echo $ip
echo $hn


service httpd stop

# 清除之前运行数据
# docker ps -a  |awk '{print $1}'|xargs docker rm
# docker images |grep "<none>"  |awk '{print $3}'|xargs docker rmi
docker ps -a|grep Exited |awk '{print $1}'|xargs docker rm >/dev/null 2>&1
# 启动php
#docker run --name nginx80 \
#-d -v /home/wolferhua/workspace/dockers/nginx/conf:/etc/nginx \
#-v /home/wolferhua/workspace/php:/home/wolferhua/workspace/php \
#-p 80:80 \
#nginx

docker ps -a|grep php56 |awk '{print $1}'|xargs docker stop >/dev/null 2>&1
docker ps -a|grep php56 |awk '{print $1}'|xargs docker rm >/dev/null 2>&1
# php 5.6
docker run -d \
--name php56 \
-d -v ~/workspace/dockers/fh/php56/etc:/usr/local/etc \
-v /www/web:/www \
--restart=always \
 wolferhua/php:5.6-fpm



docker ps -a|grep nginx80 |awk '{print $1}'|xargs docker stop >/dev/null 2>&1
docker ps -a|grep nginx80 |awk '{print $1}'|xargs docker rm >/dev/null 2>&1
# 启动nginx
docker run --name nginx80 \
--link php56:php56 \
--link php71kod:php71kod \
-d \
-v ~/workspace/dockers/fh/nginx/conf:/etc/nginx \
-v /www/web:/www \
-p 80:80 \
--restart=always \
wolferhua/nginx:1.13.10
